export default () => {
    let scrollFn;
    const vScrollFixed = {
      mounted(el) {
        const h = el.offsetHeight;
        scrollFn = () => {
          // console.log(window.scrollY);
          // console.log(h); // 10
          const y = window.scrollY;
          //   console.log(y);
          if (y > h) {
            // console.dir(el);
            el.style.position = "fixed";
            el.style.top = 0;
            el.classList.add("scroll");
            document.querySelector(".my-home").classList.add("top-50");
          } else {
            el.style.position = "";
            el.style.top = "";
            el.classList.remove("scroll");
            document.querySelector(".my-home").classList.remove("top-50");
          }
        };
        window.addEventListener("scroll", scrollFn);
      },
    };
    onBeforeUnmount(() => {
      window.removeEventListener("scroll", scrollFn);
    });
    return vScrollFixed;
}